home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 23 / super.zip / DUMBTERM.PAS < prev    next >
Pascal/Delphi Source File  |  1986-06-13  |  2KB  |  55 lines

  1. {                                 DUMBTERM
  2.            Plain vanilla comm program to demonstrate SUPERCOM.PAS
  3.  
  4.               (C) Copyright 1986, Doctor Debug, Pittsburgh Pa
  5.                             All Rights Reserved
  6.  
  7.       SUPER.COM must be loaded for this program to function correctly    
  8.  
  9. Do not run this program from the Turbo environment! Compile to a COM
  10. file first!
  11.  
  12.                         To exit program, type Ctrl-Z
  13. }
  14. {$ISupercom.Pas}      {Bring in Comm library}
  15.  
  16. Var
  17.       x:LString; {255 byte string - defined in SUPERCOM library}
  18.       a,a1:char;    
  19.       i,b,c:integer;
  20.       FilVar: Text;
  21.       FileName: String[14];
  22.  
  23. Begin   {Main Program}
  24.    writeln ('Opening Supercom Port');
  25.    InitPort(1,1200,Even,7,1);    {opens port 1}
  26.    ClearBuff;    {make sure buffer empty}
  27.    FileName := 'TEXT.TXT';
  28.    Assign(FilVar,FileName);    {open file}
  29.    Rewrite(FilVar);      {write from beginning}
  30.    a := ' ';
  31.    while a <> Chr(26)    {26 = end of file char}
  32.    Begin
  33.       if keypressed then  {this loop if key was pressed}
  34.       begin
  35.          a := GetKey;   {get keypress}
  36.          If a <> chr(26) then   {control Z? (signifies end)}
  37.             XmitCh(a);    {no, send character}
  38.       end;
  39.       c := rlen;    {# of chars in input buffer}
  40.       If c <> 0 then    {this loop if there are chars}
  41.       begin
  42.          if abs(c) > 255 then    {only get blocks of 255}
  43.             c := 255;
  44.          recblk(c,x);    {input data into x array}
  45.          for i := 1 to ord(x[0]) do   {now print to screen}
  46.             Begin
  47.                write(x[i]);
  48.                write(filvar,x[i]);    {and to file}
  49.             End; {for}
  50.       end;  {if}
  51.    end; {while}
  52.    Close(FilVar);     {close output file}
  53.    ClosePort;     {close Supercom port}
  54. end.     {Done!}
  55.